<% include header %>
<div class="container">
    <h3 id="title"><%= title %>的日记</h3>
    <hr style="width: 60%;"/>
    <% posts.forEach(function (post, index) { %>
    <div class="infos">
        <h3 style="display: inline-block;"><a href="/u/<%= post.name %>/<%= post.time.minute %>/<%= post.title %>"><%= post.name %>的日记</a></h3>
        <a href="/u/<%= post.name %>/<%= post.time.minute %>/<%= post.title %>">[<%= post.title %>]</a> |
        [<% post.tags.forEach(function (tag, index) { %>
        <% if (tag) { %>
        <a class="tag" href="/tags/<%= tag %>"><%= tag %></a>
        <% } %>
        <% }) %>]
        <p><%- post.post %></p>
        <p class="info"><%= post.time.minute %> | 阅读：<%= post.pv %> | 评论：<%= post.comments.length %></p>
    </div>
    <hr style="width: 60%;"/>
    <% }) %>
    <% if( user && user.name == title ){ %>
    <div class="pull-right right">
        <h3 id="title">欢迎回来<%= title %></h3>
        <a style="display: block;" href="/upload">
            <%if(user.txname){%>
            <img src="../images/<%= user.txname%>" alt="<%= user.name%>">
            <%}else{%>
            <img src="../images/timg.jpg">
            <%}%>
        </a>
        <br/>
        <a href="/post"><button class="btn btn-primary lang">发布文章</button></a>
        <a href="/upload"><button class="btn btn-danger lang">修改头像</button></a>
    </div>
    <% } %>
</div>
<% include footer %>